{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# Mysql与python连接初试"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "source": [
    "import torch\r\n",
    "import pymysql\r\n",
    "import numpy as np\r\n",
    "import pandas as pd\r\n",
    "\r\n",
    "print(\"love\")"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "love\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "source": [
    "# 连接MySQL.密码请使用你自己设置的密码,shop为上一节导入的示例数据库\r\n",
    "conn = pymysql.connect(host=\"127.0.0.1\", user=\"root\",password=\"******\",database=\"shop\",charset=\"utf8\")"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "source": [
    "? conn"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "\u001b[1;31mType:\u001b[0m        Connection\n",
      "\u001b[1;31mString form:\u001b[0m <pymysql.connections.Connection object at 0x000001DAC26ED358>\n",
      "\u001b[1;31mFile:\u001b[0m        e:\\python\\anaconda\\envs\\pytorch\\lib\\site-packages\\pymysql\\connections.py\n",
      "\u001b[1;31mDocstring:\u001b[0m  \n",
      "Representation of a socket with a mysql server.\n",
      "\n",
      "The proper way to get an instance of this class is to call\n",
      "connect().\n",
      "\n",
      "Establish a connection to the MySQL database. Accepts several\n",
      "arguments:\n",
      "\n",
      ":param host: Host where the database server is located\n",
      ":param user: Username to log in as\n",
      ":param password: Password to use.\n",
      ":param database: Database to use, None to not use a particular one.\n",
      ":param port: MySQL port to use, default is usually OK. (default: 3306)\n",
      ":param bind_address: When the client has multiple network interfaces, specify\n",
      "    the interface from which to connect to the host. Argument can be\n",
      "    a hostname or an IP address.\n",
      ":param unix_socket: Optionally, you can use a unix socket rather than TCP/IP.\n",
      ":param read_timeout: The timeout for reading from the connection in seconds (default: None - no timeout)\n",
      ":param write_timeout: The timeout for writing to the connection in seconds (default: None - no timeout)\n",
      ":param charset: Charset you want to use.\n",
      ":param sql_mode: Default SQL_MODE to use.\n",
      ":param read_default_file:\n",
      "    Specifies  my.cnf file to read these parameters from under the [client] section.\n",
      ":param conv:\n",
      "    Conversion dictionary to use instead of the default one.\n",
      "    This is used to provide custom marshalling and unmarshaling of types.\n",
      "    See converters.\n",
      ":param use_unicode:\n",
      "    Whether or not to default to unicode strings.\n",
      "    This option defaults to true for Py3k.\n",
      ":param client_flag: Custom flags to send to MySQL. Find potential values in constants.CLIENT.\n",
      ":param cursorclass: Custom cursor class to use.\n",
      ":param init_command: Initial SQL statement to run when connection is established.\n",
      ":param connect_timeout: Timeout before throwing an exception when connecting.\n",
      "    (default: 10, min: 1, max: 31536000)\n",
      ":param ssl:\n",
      "    A dict of arguments similar to mysql_ssl_set()'s parameters.\n",
      "    For now the capath and cipher arguments are not supported.\n",
      ":param read_default_group: Group to read from in the configuration file.\n",
      ":param compress: Not supported\n",
      ":param named_pipe: Not supported\n",
      ":param autocommit: Autocommit mode. None means use server default. (default: False)\n",
      ":param local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False)\n",
      ":param max_allowed_packet: Max size of packet sent to server in bytes. (default: 16MB)\n",
      "    Only used to limit size of \"LOAD LOCAL INFILE\" data packet smaller than default (16KB).\n",
      ":param defer_connect: Don't explicitly connect on contruction - wait for connect call.\n",
      "    (default: False)\n",
      ":param auth_plugin_map: A dict of plugin names to a class that processes that plugin.\n",
      "    The class will take the Connection object as the argument to the constructor.\n",
      "    The class needs an authenticate method taking an authentication packet as\n",
      "    an argument.  For the dialog plugin, a prompt(echo, prompt) method can be used\n",
      "    (if no authenticate method) for returning a string from the user. (experimental)\n",
      ":param server_public_key: SHA256 authenticaiton plugin public key value. (default: None)\n",
      ":param db: Alias for database. (for compatibility to MySQLdb)\n",
      ":param passwd: Alias for password. (for compatibility to MySQLdb)\n",
      ":param binary_prefix: Add _binary prefix on bytes and bytearray. (default: False)\n",
      "\n",
      "See `Connection <https://www.python.org/dev/peps/pep-0249/#connection-objects>`_ in the\n",
      "specification.\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "source": [
    "host=None,# 要连接的主机地址, 本机上的 MySQL 使用 127.0.0.1\r\n",
    "user=None,# 用于登录的数据库用户名, 例如 root.\r\n",
    "password='',# 上述账号的相应密码\r\n",
    "database=None,# 要连接的数据库,本教程使用的是来源于<SQL 基础教程>的 shop 数据库\r\n",
    "port=0,# 端口，一般为 3306\r\n",
    "unix_socket=None,# 选择是否要用 unix_socket 而不是 TCP/IP\r\n",
    "charset='',# 字符编码, 需要支持中文请使用\"utf8\"\r\n",
    "sql_mode=None,# Default SQL_MODE to use.\r\n",
    "read_default_file=None,# 从默认配置文件(my.ini 或 my.cnf)中读取参数\r\n",
    "conv=None,# 转换字典\r\n",
    "use_unicode=None,# 是否使用 unicode 编码\r\n",
    "client_flag=0,# Custom flags to send to MySQL. Find potential values in constants.CLIENT.\r\n",
    "cursorclass=,# 选择 Cursor 类型\r\n",
    "init_command=None,# 连接建立时运行的初始语句\r\n",
    "connect_timeout=10,# 连接超时时间，(default: 10, min: 1, max: 31536000)\r\n",
    "ssl=None,# A dict of arguments similar to mysql_ssl_set()'s parameters.For now the capath and cipher arguments are not supported.\r\n",
    "read_default_group=None,# Group to read from in the configuration file.\r\n",
    "compress=None,# 不支持\r\n",
    "named_pipe=None,# 不支持\r\n",
    "no_delay=None,#\r\n",
    "autocommit=False,# 是否自动提交事务\r\n",
    "db=None,# 同 database，为了兼容 MySQLdb\r\n",
    "passwd=None,# 同 password，为了兼容 MySQLdb\r\n",
    "local_infile=False,# 是否允许载入本地文件\r\n",
    "max_allowed_packet=16777216,# 限制 `LOCAL DATA INFILE` 大小\r\n",
    "defer_connect=False,# Don't explicitly connect on contruction - wait for connect call.\r\n",
    "auth_plugin_map={},#\r\n",
    "read_timeout=None,#\r\n",
    "write_timeout=None,\r\n",
    "bind_address=None# 当客户有多个网络接口，指定一个连接到主机\r\n"
   ],
   "outputs": [
    {
     "output_type": "error",
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-26-5442f83379b5>, line 13)",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-26-5442f83379b5>\"\u001b[1;36m, line \u001b[1;32m13\u001b[0m\n\u001b[1;33m    cursorclass=,# 选择 Cursor 类型\u001b[0m\n\u001b[1;37m                ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [
    "USE shop"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [
    "SELECT *\r\n",
    "  FROM product;"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "source": [
    "cur = conn.cursor()"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "source": [
    "# 定义要执行的 SQL 语句\r\n",
    "sql = \"\"\"\r\n",
    "SELECT * FROM product;\r\n",
    "\"\"\"\r\n",
    "cur.execute(sql)"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "metadata": {},
     "execution_count": 53
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "source": [
    "# ? sql\r\n",
    "type(cur.execute(sql))\r\n",
    "type(sql)"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "metadata": {},
     "execution_count": 54
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "source": [
    "cur.fetchall()"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "(('0001', 'T恤', '衣服', 1000, 500, datetime.date(2009, 9, 20)),\n",
       " ('0002', '打孔器', '办公用品', 500, 320, datetime.date(2009, 9, 11)),\n",
       " ('0003', '运动T恤', '衣服', 4000, 2800, None),\n",
       " ('0004', '菜刀', '厨房用具', 3000, 2800, datetime.date(2009, 9, 20)),\n",
       " ('0005', '高压锅', '厨房用具', 6800, 5000, datetime.date(2009, 1, 15)),\n",
       " ('0006', '叉子', '厨房用具', 500, None, datetime.date(2009, 9, 20)),\n",
       " ('0007', '擦菜板', '厨房用具', 880, 790, datetime.date(2008, 4, 28)),\n",
       " ('0008', '圆珠笔', '办公用品', 100, None, datetime.date(2009, 11, 11)))"
      ]
     },
     "metadata": {},
     "execution_count": 38
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 1.连接数据库\r\n",
    "# 2.写SQL查询语句，易字符串的形式，但是要保证'''''',防止SQL内部命令有引号冲突\r\n",
    "\r\n",
    "# 3. 三个命令：\r\n",
    "### * cur = conn.cursor() 得到数据库游标\r\n",
    "### * cur.execute(sql)执行SQL语句，并且输出返回值，查询的数据条数\r\n",
    "### * cur.fetchall() 返回查询的数据\r\n"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "source": [
    "data = cur.fetchall()\r\n",
    "type(data)"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "metadata": {},
     "execution_count": 55
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "source": [
    "data"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "(('0001', 'T恤', '衣服', 1000, 500, datetime.date(2009, 9, 20)),\n",
       " ('0002', '打孔器', '办公用品', 500, 320, datetime.date(2009, 9, 11)),\n",
       " ('0003', '运动T恤', '衣服', 4000, 2800, None),\n",
       " ('0004', '菜刀', '厨房用具', 3000, 2800, datetime.date(2009, 9, 20)),\n",
       " ('0005', '高压锅', '厨房用具', 6800, 5000, datetime.date(2009, 1, 15)),\n",
       " ('0006', '叉子', '厨房用具', 500, None, datetime.date(2009, 9, 20)),\n",
       " ('0007', '擦菜板', '厨房用具', 880, 790, datetime.date(2008, 4, 28)),\n",
       " ('0008', '圆珠笔', '办公用品', 100, None, datetime.date(2009, 11, 11)))"
      ]
     },
     "metadata": {},
     "execution_count": 56
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "source": [
    "import torch \r\n",
    "import pandas as pd\r\n",
    "#######很遗憾，columns没了\r\n",
    "df = pd.DataFrame(data)\r\n",
    "df"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "      0     1     2     3       4           5\n",
       "0  0001    T恤    衣服  1000   500.0  2009-09-20\n",
       "1  0002   打孔器  办公用品   500   320.0  2009-09-11\n",
       "2  0003  运动T恤    衣服  4000  2800.0        None\n",
       "3  0004    菜刀  厨房用具  3000  2800.0  2009-09-20\n",
       "4  0005   高压锅  厨房用具  6800  5000.0  2009-01-15\n",
       "5  0006    叉子  厨房用具   500     NaN  2009-09-20\n",
       "6  0007   擦菜板  厨房用具   880   790.0  2008-04-28\n",
       "7  0008   圆珠笔  办公用品   100     NaN  2009-11-11"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0001</td>\n",
       "      <td>T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>1000</td>\n",
       "      <td>500.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0002</td>\n",
       "      <td>打孔器</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>500</td>\n",
       "      <td>320.0</td>\n",
       "      <td>2009-09-11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0003</td>\n",
       "      <td>运动T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>4000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0004</td>\n",
       "      <td>菜刀</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>3000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0005</td>\n",
       "      <td>高压锅</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>6800</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>2009-01-15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0006</td>\n",
       "      <td>叉子</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0007</td>\n",
       "      <td>擦菜板</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>880</td>\n",
       "      <td>790.0</td>\n",
       "      <td>2008-04-28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0008</td>\n",
       "      <td>圆珠笔</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>100</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-11-11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "metadata": {},
     "execution_count": 57
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 更方便的读取，以DataFrame来读取\r\n",
    "### * pd.read_sql(sql,conn)   sql:即查询语句 conn:即数据库的对象"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "source": [
    "import pandas as pd\r\n",
    "df = pd.read_sql(sql,conn)\r\n",
    "df"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "  product_id product_name product_type  sale_price  purchase_price regist_date\n",
       "0       0001           T恤           衣服        1000           500.0  2009-09-20\n",
       "1       0002          打孔器         办公用品         500           320.0  2009-09-11\n",
       "2       0003         运动T恤           衣服        4000          2800.0        None\n",
       "3       0004           菜刀         厨房用具        3000          2800.0  2009-09-20\n",
       "4       0005          高压锅         厨房用具        6800          5000.0  2009-01-15\n",
       "5       0006           叉子         厨房用具         500             NaN  2009-09-20\n",
       "6       0007          擦菜板         厨房用具         880           790.0  2008-04-28\n",
       "7       0008          圆珠笔         办公用品         100             NaN  2009-11-11"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>product_id</th>\n",
       "      <th>product_name</th>\n",
       "      <th>product_type</th>\n",
       "      <th>sale_price</th>\n",
       "      <th>purchase_price</th>\n",
       "      <th>regist_date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0001</td>\n",
       "      <td>T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>1000</td>\n",
       "      <td>500.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0002</td>\n",
       "      <td>打孔器</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>500</td>\n",
       "      <td>320.0</td>\n",
       "      <td>2009-09-11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0003</td>\n",
       "      <td>运动T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>4000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0004</td>\n",
       "      <td>菜刀</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>3000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0005</td>\n",
       "      <td>高压锅</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>6800</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>2009-01-15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0006</td>\n",
       "      <td>叉子</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0007</td>\n",
       "      <td>擦菜板</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>880</td>\n",
       "      <td>790.0</td>\n",
       "      <td>2008-04-28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0008</td>\n",
       "      <td>圆珠笔</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>100</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-11-11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "metadata": {},
     "execution_count": 59
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "source": [
    "# 关闭游标对象\r\n",
    "cur.close()\r\n",
    "# 关闭数据库连接\r\n",
    "conn.close()"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "source": [
    "df"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "  product_id product_name product_type  sale_price  purchase_price regist_date\n",
       "0       0001           T恤           衣服        1000           500.0  2009-09-20\n",
       "1       0002          打孔器         办公用品         500           320.0  2009-09-11\n",
       "2       0003         运动T恤           衣服        4000          2800.0        None\n",
       "3       0004           菜刀         厨房用具        3000          2800.0  2009-09-20\n",
       "4       0005          高压锅         厨房用具        6800          5000.0  2009-01-15\n",
       "5       0006           叉子         厨房用具         500             NaN  2009-09-20\n",
       "6       0007          擦菜板         厨房用具         880           790.0  2008-04-28\n",
       "7       0008          圆珠笔         办公用品         100             NaN  2009-11-11"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>product_id</th>\n",
       "      <th>product_name</th>\n",
       "      <th>product_type</th>\n",
       "      <th>sale_price</th>\n",
       "      <th>purchase_price</th>\n",
       "      <th>regist_date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0001</td>\n",
       "      <td>T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>1000</td>\n",
       "      <td>500.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0002</td>\n",
       "      <td>打孔器</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>500</td>\n",
       "      <td>320.0</td>\n",
       "      <td>2009-09-11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0003</td>\n",
       "      <td>运动T恤</td>\n",
       "      <td>衣服</td>\n",
       "      <td>4000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0004</td>\n",
       "      <td>菜刀</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>3000</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0005</td>\n",
       "      <td>高压锅</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>6800</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>2009-01-15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0006</td>\n",
       "      <td>叉子</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-09-20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0007</td>\n",
       "      <td>擦菜板</td>\n",
       "      <td>厨房用具</td>\n",
       "      <td>880</td>\n",
       "      <td>790.0</td>\n",
       "      <td>2008-04-28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0008</td>\n",
       "      <td>圆珠笔</td>\n",
       "      <td>办公用品</td>\n",
       "      <td>100</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2009-11-11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "metadata": {},
     "execution_count": 61
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "source": [],
   "outputs": [],
   "metadata": {}
  }
 ],
 "metadata": {
  "orig_nbformat": 4,
  "language_info": {
   "name": "python",
   "version": "3.6.10",
   "mimetype": "text/x-python",
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "pygments_lexer": "ipython3",
   "nbconvert_exporter": "python",
   "file_extension": ".py"
  },
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3.6.10 64-bit ('pytorch': conda)"
  },
  "interpreter": {
   "hash": "5ed2706e4a6a6e0eab4e39c5c091353f724706d502196bb7625b0048b53345f6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}